﻿Public Class Register
    Private Sub cmdOK_Click(sender As Object, e As EventArgs) Handles cmdOK.Click
        If username.Text = "" Then
            MsgBox("请输入用户名！")
            username.Focus()
            Exit Sub
        End If
        If password.Text = "" Then
            MsgBox("请输入密码！")
            password.Focus()
            Exit Sub
        End If
        Dim icount As Integer
        txtSQL = "SELECT * FROM 用户 WHERE 用户名='" & username.Text & " ' "
        icount = ExecuteSQL(txtSQL, ErrorMsg)
        If icount = 0 Then
            MsgBox("没有此用户，请重新输入用户名！", vbExclamation)
            username.Focus()
            Exit Sub
        ElseIf icount = -1 Then
            MsgBox("程序出错！", vbExclamation)
            username.Focus()
            Exit Sub
        End If
        If Trim(password.Text) = Trim(DBSet.Tables.Item(0).Rows.Item(0).Item("密码").ToString()) Then
            username_OK = DBSet.Tables.Item(0).Rows.Item(0).Item("用户名")
            frmMain.Show()
            Finalize()
        Else
            MsgBox("密码不正确，请重新输入密码！", vbExclamation)
            password.Focus()
        End If
    End Sub

    Private Sub cmdExit_Click(sender As Object, e As EventArgs) Handles cmdExit.Click
        Me.Close()
    End Sub
End Class